<?php

/**
 * This is the model class for table "pembayaran_pinjaman".
 *
 * The followings are the available columns in table 'pembayaran_pinjaman':
 * @property integer $ID_BAYAR
 * @property integer $ID_PINJAMAN
 * @property string $TANGGAL_TRANSAKSI
 * @property string $TANGGAL_INPUT
 * @property string $JUMLAH_BAYAR
 * @property string $KETERANGAN
 */
class PembayaranPinjaman extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return PembayaranPinjaman the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pembayaran_pinjaman';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('ID_PINJAMAN, TANGGAL_TRANSAKSI, JUMLAH_BAYAR', 'required'),
			array('JUMLAH_BAYAR,ID_PINJAMAN', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID_BAYAR, ID_PINJAMAN, TANGGAL_TRANSAKSI, TANGGAL_INPUT, JUMLAH_BAYAR, KETERANGAN', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'pinjaman'=>array(self::BELONGS_TO, 'Pinjaman', 'ID_PINJAMAN'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID_BAYAR' => 'Id Bayar',
			'ID_PINJAMAN' => 'Id Pinjaman',
			'TANGGAL_TRANSAKSI' => 'Tanggal Transaksi',
			'TANGGAL_INPUT' => 'Tanggal Input',
			'JUMLAH_BAYAR' => 'Jumlah Bayar',
			'KETERANGAN' => 'Keterangan',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID_BAYAR',$this->ID_BAYAR);
		$criteria->compare('ID_PINJAMAN',$this->ID_PINJAMAN);
		$criteria->compare('TANGGAL_TRANSAKSI',$this->TANGGAL_TRANSAKSI,true);
		$criteria->compare('TANGGAL_INPUT',$this->TANGGAL_INPUT,true);
		$criteria->compare('JUMLAH_BAYAR',$this->JUMLAH_BAYAR,true);
		$criteria->compare('KETERANGAN',$this->KETERANGAN,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}